package com.haizhi.messagehub.config.topic;

import java.util.Timer;

import javax.annotation.Resource;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class TopicDaemonWarden implements InitializingBean {

    @Resource
    TopicReloadTask topicReloadTask;


    @Bean
    public void topicReload() {
        Timer timer = new Timer();
        System.out.println("reload start");
        timer.schedule(topicReloadTask, 60000, 60000);
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        topicReloadTask.run();
    }
}
